package probe

import (
	"github.com/Unixeno/TheMoon/model"
	"github.com/shirou/gopsutil/cpu"
	"github.com/shirou/gopsutil/host"
	"runtime"
)

func GetNodeInfo() *model.NodeInfo {

	cpuInfo, _ := cpu.Info()
	cpuCount, _ := cpu.Counts(true)

	kernelVersion, _ := host.KernelVersion()
	platform, _, version, _ := host.PlatformInformation()

	return &model.NodeInfo{
		Cores:  cpuCount,
		CPU:    cpuInfo[0].ModelName,
		OS:     platform + " " + version,
		Arch:   runtime.GOARCH,
		Kernel: kernelVersion,
	}
}
